All Event Handlers
onAbort
onError
onUnload
EVENT HANDLER: onload
onload
= myJavaScriptCode
Event handler for
Image
,
Layer
and
Window
.
The
onload
event handler executes the specified JavaScript code or function on the occurance of a Load event. A Load event occurs when the browser finishes loading a window or all the frames in a window.
The
onload
event handler uses the following
Event
object properties.
type
- this property indicates the type of event.
target
- this property indicates the object to which the event was originally sent.
width
- when the event is over a window, not a layer, this represents the width of the window.
height
- when the event is over a window, not a layer, this represents the height of the window.
The following example shows the use of the
onload
event handler to display a message in the text box.
Code:
<body onload = "changeVal()" >
<form action="" method="POST" id="myForm" >
<input type="text" name="myText" >
<script type="text/javascript" language="JavaScript">
s1 = new String(myForm.myText.value)
function changeVal() {
s1 = "Greetings!"
myForm.myText.value = s1.toUpperCase()
}
</script>
</form>
</body>
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information